﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net;

public partial class lyt : System.Web.UI.Page
{
    string uid = "sandbox_19760426";
    string url = "http://container.open.taobao.com/container";
    string sessionKey = "";
    string appkey = "1021236413";
    string secret = "sandbox17043c6b462896102f96efd39";
    private string code;
    protected string token;

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            //if (Request["code"] != string.Empty)
            //{
            //    code = Request["code"];

            //    IDictionary<string, string> param = new Dictionary<string, string>();

            //    param.Add("response_type", "code");
            //    param.Add("client_id", appkey);
            //    param.Add("redirect_uri", "http://localhost:64822/lyt/lyt.aspx");
            //    param.Add("state", "1212");
            //    param.Add("scope", "item");
            //    param.Add("view", "web");
            //    param.Add("code", code);
            //    param.Add("client_secret", secret);
            //    param.Add("grant_type", "authorization_code");

            //    string p = "response_type=code&redirect_uri=http://localhost:64822/lyt/lyt.aspx&scope=item&view=web&grant_type=authorization_code&client_id=" + appkey + "&code=" + code + "&client_secret=" + secret;

            //    string result = Util.Post("https://oauth.tbsandbox.com/token?" + p);

            //    System.Web.Script.Serialization.JavaScriptSerializer a = new System.Web.Script.Serialization.JavaScriptSerializer();
            //    Dictionary<string, object> b = a.Deserialize<Dictionary<string, object>>(result);

            //    token = b["access_token"].ToString();
            //    Session.Add("token", token);
            //}
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        
    }
}